.TH FL_connect 3 "Dec 2000" "Flush Spread" "User Manuals"
.SH NAME
FL_connect \- connect an application to a Spread daemon using Flush Spread semantics.
.SH SYNOPSIS
.B #include <fl.h>

.BI "int FL_connect(const char *" daemon_name ", const char *" user_name ", int " priority ", int " group_membership ", mailbox *" mbox ", char *" private_name );
.SH DESCRIPTION
.B FL_connect
is the initial call an application must make to establish a
connection with a Spread daemon.  All other Flush Spread calls
refer to a valid 
.I mbox 
returned by this function.

The 
.I daemon_name
is the name of the Spread daemon with which to connect.  It should be a
string in one of the following forms:
.RS
.TP
.B "4803" 
This will connect to the Spread daemon on the local 
machine running on port 4803.  This form cannot be
used to connect to a Windows95/NT machine.
.TP
.B "4803@localhost" 
This will also connect to the Spread daemon 
on the local machine running on port 4803.
This form can be used on Windows95/NT machines.
.TP
.BR "4803@host.domain.edu " or " 4803@128.220.221.99"     
This will connect to the machine identified by either 
domain name or IP address at the specified port. 
.RE

The
.I user_name 
is the name this connection would like to be known as.  It must be
unique on the machine running the spread daemon.  The name can be an
arbitrary length string with the same character restrictions as a
group name (mainly it cannot contain the '#' character).

.I priority
is a boolean (non-zero true, zero false) for whether this connection
will be a "priority" connection or not. Currently this has no effect.

.I group_membership
is a boolean for whether this connection will receive group membership
messages or not.  Usually for Flush Spread applications this parameter
should be true.  If your application doesn't need group membership
messages, then Spread may provide the semantics that you need more
efficiently than Flush Spread.

The
.I mbox
should be a pointer to a mailbox variable.  After the 
.B FL_connect
call successfully returns, this variable will hold the valid mbox for
this new connection.

The
.I private_name
should be a pointer to a string big enough to hold at least
MAX_GROUP_NAME characters.  After the call returns it will contain the
private group name of this connection.  These group names are what are
reported in membership messages and can be used to send unicast and
subgroup-multicast messages to this connection.  No other applications
can join this special group.

.SH "RETURN VALUES"
Returns 
.B ACCEPT_SESSION 
on success or one of the following errors ( < 0 ):
.TP
.B ILLEGAL_SPREAD
The 
.I daemon_name
given to connect to was illegal for some reason. Usually because
it was a unix socket on Windows95/NT, an improper format for a host
or an illegal port number
.TP
.B COULD_NOT_CONNECT
Lower level socket calls failed to allow a connection to the 
specified spread daemon right now.
.TP
.B CONNECTION_CLOSED
During communication to establish the connection errors occured
and the setup could not be completed.
.TP
.B REJECT_VERSION
The daemon and/or libraries have a version mismatch.
.TP
.B REJECT_NO_NAME
No user name was provided.
.TP
.B REJECT_ILLEGAL_NAME
Name provided violated some requirement (length or used an illegal character)
.TP
.B REJECT_NOT_UNIQUE
Name provided is not unique on this daemon. Recommended response is to try
again with a different name.
.SH AUTHOR
John Schultz <jschultz@cnds.jhu.edu>

